package com.ete.service.manager.version

import com.ete.service.callback.version.AutoCheckCallback
import com.ete.service.callback.version.ManualCheckCallback
import com.ete.service.callback.version.SilentCheckCallback
import com.ete.service.entry.version.VersionEntry
import com.ete.service.service.log.UploadLogUtil
import com.ete.service.service.version.VersionHelper

/**
 * Author:LiXian
 * <p>
 * Desc:版本更新管理器
 * Version:1.0
 * date 2024/1/18 11:19
 */
object VersionManager {

    const val TAG = "VersionManager"

    /**
     * 初始化
     */
    @JvmStatic
    fun init(mVersionEntry: VersionEntry) {
        VersionHelper.init(mVersionEntry)
    }

    /**
     * 获取主题色
     */
    @JvmStatic
    fun getThemeColor(): Int {
        return UploadLogUtil.getThemeColor()
    }

    /**
     * 自动版本检查
     */
    @JvmStatic
    @JvmOverloads
    fun autoCheckNewVersion(mCallback: AutoCheckCallback? = null) {
        VersionHelper.autoCheckNewVersion(mCallback)
    }

    /**
     * 手动版本检查
     */
    @JvmStatic
    @JvmOverloads
    fun manualCheckNewVersion(mCallback: ManualCheckCallback? = null) {
        VersionHelper.manualCheckNewVersion(mCallback)
    }

    /**
     * 静默版本检查
     */
    @JvmStatic
    fun silentCheckNewVersion(mCallback: SilentCheckCallback) {
        VersionHelper.silentCheckNewVersion(mCallback)
    }

    /**
     * 检查安装App权限
     */
    @JvmStatic
    fun isInstallPermission(): Boolean {
        return VersionHelper.isInstallPermission()
    }

    /**
     * 安装App
     */
    @JvmStatic
    fun installApp(mApkPath: String) {
        VersionHelper.installApp(mApkPath)
    }
}